#ifndef SETTINGSHELPER_H
#define SETTINGSHELPER_H

#include <windows.h>
#include <fstream>
#include <set>
#include <map>
#include <list>

class Settings;

#include "Scheduler.h"
#include "Utilities.h"
#include "BinaryFileHelper.h"


using namespace std;

class Settings
{
public:
	struct CassiopeiaMainData
	{
		bool ExtendedSystemMenu;
		bool TransparencyOnMoveSize;
		bool GlassConsole;
		bool AdvancedShowDesktop;
		bool DeskNotes;
		bool Scheduler;
		bool DeskTidy;
		//bool KeyLock;
		bool WindowGroups;
		bool DesktopPictureFrame;
		bool QuickButtons;
	};

	struct DeskNotesData
	{
		RECT DeskNoteBounds;
		bool Shrunken;
		int RestoredHeight;
		bool TopMost;
		bool TransparentOnLeave;
		int ZoomNumerator;
		int ZoomDenominator;
		POINT ScrollPosition;
	};

	struct SchedulerData
	{
		Scheduler::AlertTimeInfo Alert;
		TCHAR LastSoundFile[_MAX_PATH];
		bool LastSoundActive;
	};

	struct DeskTidyWndData
	{
		RECT Bounds;
		TCHAR Text[_MAX_PATH];
		bool Visible;
		bool Active;
		bool Locked;
		set<tstring, TStringSortTemplate> ExtensionList;
	};

	struct DeskTidyData
	{
		map<int, DeskTidyWndData> DeskTidyWndData;
		int IDCounter;
		list<int> FreeIDPool;
	};

	struct WindowGroupsData
	{
		map<int, tstring> Groups;
		POINT Location;
		bool Opened;
	};

	/*struct KeyLockData
	{
		DWORD PrimarySerialNumber;
		DWORD SecondarySerialNumber;
		bool LockAtUnplug;
	};*/

	struct DesktopPictureFrameData
	{
		RECT Bounds;
	};

	struct QuickButtonsData
	{
		map<int, int> Functions;
		map<int, tstring> Type1Commands;
		POINT Location;
		bool Opened;
	};

	struct Data
	{
		TCHAR lang[20];
		CassiopeiaMainData CassiopeiaMainData;
		DeskNotesData DeskNotesData;
		SchedulerData SchedulerData;
		DeskTidyData DeskTidyData;
		//KeyLockData KeyLockData;
		WindowGroupsData WindowGroupsData;
		DesktopPictureFrameData DesktopPictureFrameData;
		QuickButtonsData QuickButtonsData;
	};
	
	Settings();
	bool Save(Settings::Data data);
	bool Load(Settings::Data * data);
};

#endif
